<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Schedulatore EDF:  File sorgente trunk/scheduler.h</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generato da Doxygen 1.7.1 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Cerca');
--></script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Pagina&nbsp;Principale</span></a></li>
      <li><a href="annotated.html"><span>Classi</span></a></li>
      <li class="current"><a href="files.html"><span>File</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Cerca" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Elenco&nbsp;dei&nbsp;file</span></a></li>
      <li><a href="globals.html"><span>Membri&nbsp;dei&nbsp;file</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>trunk/scheduler.h</h1>  </div>
</div>
<div class="contents">
<a href="scheduler_8h.html">Vai alla documentazione di questo file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#pragma once</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#include &lt;winsock.h&gt;</span>
<a name="l00003"></a>00003 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &quot;<a class="code" href="types_8h.html">types.h</a>&quot;</span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &quot;<a class="code" href="_kiwi_logger_8h.html">KiwiLogger.h</a>&quot;</span>
<a name="l00006"></a>00006 
<a name="l00007"></a><a class="code" href="class_scheduler.html">00007</a> <span class="keyword">class </span><a class="code" href="class_scheduler.html">Scheduler</a>
<a name="l00008"></a>00008 {
<a name="l00009"></a>00009 <span class="keyword">public</span>:
<a name="l00015"></a>00015         <a class="code" href="class_scheduler.html#a74d36dc32c4c03dc65f30d1fd5cea83a">Scheduler</a>(<span class="keywordtype">char</span>* kiwi_output_path);
<a name="l00016"></a>00016         <a class="code" href="class_scheduler.html#a531897664f05b540458f4871abb6ac04">~Scheduler</a>(<span class="keywordtype">void</span>);
<a name="l00017"></a>00017 
<a name="l00021"></a>00021         <a class="code" href="types_8h.html#aa6a31e94798d5a5d01eb6496550183f8">SCHERR</a>  <a class="code" href="class_scheduler.html#a9f529dac7275042bb4028e85e3bd15d1">start_simulation</a>();
<a name="l00022"></a>00022 
<a name="l00026"></a>00026         <a class="code" href="types_8h.html#aa6a31e94798d5a5d01eb6496550183f8">SCHERR</a>  <a class="code" href="class_scheduler.html#af90c4e6d7b018546c2b77cc7fe495e06">stop_simulation</a>();
<a name="l00027"></a>00027 
<a name="l00034"></a>00034         <a class="code" href="types_8h.html#aa6a31e94798d5a5d01eb6496550183f8">SCHERR</a>  <a class="code" href="class_scheduler.html#ae5e8a8ccd94d2215b8c6f20a3d2f5e5a">task_create</a>(<a class="code" href="struct___job.html">Job</a> job, timespec phase, timespec period);
<a name="l00035"></a>00035         
<a name="l00042"></a>00042         <a class="code" href="types_8h.html#aa6a31e94798d5a5d01eb6496550183f8">SCHERR</a>  <a class="code" href="class_scheduler.html#ae5e8a8ccd94d2215b8c6f20a3d2f5e5a">task_create</a>(<a class="code" href="struct___job.html">Job</a> job, <span class="keywordtype">double</span> phase, <span class="keywordtype">double</span> period);
<a name="l00043"></a>00043         
<a name="l00048"></a>00048         <a class="code" href="types_8h.html#aa6a31e94798d5a5d01eb6496550183f8">SCHERR</a>  <a class="code" href="class_scheduler.html#ae5e8a8ccd94d2215b8c6f20a3d2f5e5a">task_create</a>(vector&lt;Job&gt; vJobList);
<a name="l00049"></a>00049 
<a name="l00050"></a>00050 <span class="keyword">private</span>:
<a name="l00051"></a>00051 
<a name="l00056"></a>00056         <span class="keywordtype">bool</span>    <a class="code" href="class_scheduler.html#a45f5bc2766acb9c68a59ca72efb73ef0">is_feasible</a>(<a class="code" href="struct___p_task.html">PTask</a> ptask);
<a name="l00057"></a>00057 
<a name="l00062"></a>00062         <span class="keyword">static</span> <span class="keywordtype">void</span>*    <a class="code" href="class_scheduler.html#a5c4cca4b781d86ae6694aa7fd1ea5c6e">ReadyListManager</a>(<span class="keywordtype">void</span>* arg);
<a name="l00063"></a>00063         
<a name="l00068"></a>00068         <span class="keyword">static</span> <span class="keywordtype">void</span>*    <a class="code" href="class_scheduler.html#aace7d12e9775eff61f0ad024c5c345f4">PTaskManager</a>(<span class="keywordtype">void</span>* arg);
<a name="l00069"></a>00069         
<a name="l00074"></a>00074         <span class="keyword">static</span> <span class="keywordtype">void</span>*    <a class="code" href="class_scheduler.html#ac557cecdaffd293f3cd996b59397b13d">ATaskManager</a>(<span class="keywordtype">void</span>* arg);
<a name="l00075"></a>00075 
<a name="l00076"></a>00076 <span class="keyword">private</span>:
<a name="l00077"></a><a class="code" href="class_scheduler.html#af21baa68d724b512a5c2a483ae091b45">00077</a>         <a class="code" href="struct___job.html">Job</a>                     <a class="code" href="class_scheduler.html#af21baa68d724b512a5c2a483ae091b45" title="Job in esecuzione.">m_JRunningJob</a>;          
<a name="l00078"></a>00078 
<a name="l00079"></a><a class="code" href="class_scheduler.html#a7c49282eb6287a6a7908e48b2024fc01">00079</a>         <a class="code" href="types_8h.html#a42d6bbc221c566edb75d253be9baeaf3" title="coda con priorità ordinata secondo le deadline dei job contenuti.">JobPrQue</a>        <a class="code" href="class_scheduler.html#a7c49282eb6287a6a7908e48b2024fc01" title="lita dei job che sono già stati rilasciati e pronti per l&amp;#39;esecuzione.">m_JReadyList</a>;           
<a name="l00080"></a><a class="code" href="class_scheduler.html#ac10eb1ebc947f9c9a7e895d4d18c76fb">00080</a>         <a class="code" href="types_8h.html#a550957e9dbf1dbf60e8abbc61713ab43" title="coda con priorità ordinata secondo le release dei task periodici contenuti.">PTaskRPrQue</a>     <a class="code" href="class_scheduler.html#ac10eb1ebc947f9c9a7e895d4d18c76fb" title="Tabella dei Task periodici.">m_PTaskTable</a>;           
<a name="l00081"></a><a class="code" href="class_scheduler.html#adbb2d0237eeb147b48ab565226d89df9">00081</a>         <a class="code" href="types_8h.html#a56c0d89774db65cbed9a88f6801898e3" title="coda con priorità ordinata secondo le release dei task aperiodici contenuti.">ATaskRPrQue</a>     <a class="code" href="class_scheduler.html#adbb2d0237eeb147b48ab565226d89df9" title="Tabella dei Task aperiodici.">m_ATaskTable</a>;           
<a name="l00082"></a>00082 
<a name="l00083"></a><a class="code" href="class_scheduler.html#a0f7e3e9f6d5c77464c48123a6a205609">00083</a>         pthread_mutex_t <a class="code" href="class_scheduler.html#a0f7e3e9f6d5c77464c48123a6a205609" title="mutex per controllare l&amp;#39;accesso alla risorsa ReadyList.">m_mRLMutex</a>;             
<a name="l00084"></a><a class="code" href="class_scheduler.html#a6937570c4517db0987b3498f30f1e1ed">00084</a>         pthread_mutex_t <a class="code" href="class_scheduler.html#a6937570c4517db0987b3498f30f1e1ed" title="mutex per controllare l&amp;#39;accesso alla risorsa Periodic Task Table.">m_mPTTMutex</a>;    
<a name="l00085"></a><a class="code" href="class_scheduler.html#ae7a66125191e2f823dac1306abb3f0f3">00085</a>         pthread_mutex_t <a class="code" href="class_scheduler.html#ae7a66125191e2f823dac1306abb3f0f3" title="mutex per controllare l&amp;#39;accesso alla risorsa Aperiodic Task Table.">m_mATTMutex</a>;    
<a name="l00086"></a>00086 
<a name="l00087"></a><a class="code" href="class_scheduler.html#a8a42dd298e9dddf0f3e496caae60694e">00087</a>         pthread_cond_t  <a class="code" href="class_scheduler.html#a8a42dd298e9dddf0f3e496caae60694e" title="evento che segnala l&amp;#39;introduzione di un job nella ReadyList.">m_cndReadyList</a>; 
<a name="l00088"></a><a class="code" href="class_scheduler.html#a13d1d885194983108db7a4a392fffc41">00088</a>         pthread_cond_t  <a class="code" href="class_scheduler.html#a13d1d885194983108db7a4a392fffc41" title="evento che segnala l&amp;#39;introduzione di un Task nella Periodic Task Table.">m_cndPTaskTable</a>;
<a name="l00089"></a><a class="code" href="class_scheduler.html#ad60fe736a3df2fe26281d728e62ef21c">00089</a>         pthread_cond_t  <a class="code" href="class_scheduler.html#ad60fe736a3df2fe26281d728e62ef21c" title="evento che segnala l&amp;#39;introduzione di un Task nella Aperiodic Task Table.">m_cndATaskTable</a>;
<a name="l00090"></a>00090 
<a name="l00091"></a><a class="code" href="class_scheduler.html#aec37c2a853db67fa4d6489232ff36a91">00091</a>         pthread_cond_t  <a class="code" href="class_scheduler.html#aec37c2a853db67fa4d6489232ff36a91" title="evento che segnala il corretto avvio dello scheduler.">m_cndSchedReady</a>;
<a name="l00092"></a>00092 
<a name="l00093"></a><a class="code" href="class_scheduler.html#a3338c729297b7384ad5e36c1c32b5fea">00093</a>         pthread_t       <a class="code" href="class_scheduler.html#a3338c729297b7384ad5e36c1c32b5fea" title="Thread per la gestione dell&amp;#39;esecizione dei job.">m_thReadyListThread</a>;
<a name="l00094"></a><a class="code" href="class_scheduler.html#ac3a921d412d0f1091b7abffc4f99894c">00094</a>         pthread_t       <a class="code" href="class_scheduler.html#ac3a921d412d0f1091b7abffc4f99894c" title="Thread per la gestione del rilascio dei task periodici.">m_thPTaskThread</a>;        
<a name="l00095"></a><a class="code" href="class_scheduler.html#a8484e96dec3cea88fc539b1ed14bd576">00095</a>         pthread_t       <a class="code" href="class_scheduler.html#a8484e96dec3cea88fc539b1ed14bd576" title="Thread per la gestione del rilascio dei task aperiodici.">m_thATaskThread</a>;        
<a name="l00096"></a>00096 
<a name="l00097"></a><a class="code" href="class_scheduler.html#ab185998e93c5a446f5d8a9a50076490b">00097</a>         sem_t           <a class="code" href="class_scheduler.html#ab185998e93c5a446f5d8a9a50076490b" title="Semaforo per attendere la corretta inizializzazione del gestore dei task periodici.">m_semPTManReady</a>;        
<a name="l00098"></a><a class="code" href="class_scheduler.html#a0a8d5aa73b4a97d2f1b4abafe52d34d9">00098</a>         sem_t           <a class="code" href="class_scheduler.html#a0a8d5aa73b4a97d2f1b4abafe52d34d9" title="Semaforo per attendere la corretta inizializzazione del gestore dei task aperiodici.">m_semATManReady</a>;        
<a name="l00099"></a><a class="code" href="class_scheduler.html#a5c48ae82cf02b50a42a6fd312a854543">00099</a>         sem_t           <a class="code" href="class_scheduler.html#a5c48ae82cf02b50a42a6fd312a854543" title="Semaforo per attendere la corretta inizializzazione del gestore della ReadyList.">m_semRLManReady</a>;        
<a name="l00100"></a>00100 
<a name="l00101"></a><a class="code" href="class_scheduler.html#a2f90a32a827f3555c02b960beeeb9657">00101</a>         timespec        <a class="code" href="class_scheduler.html#a2f90a32a827f3555c02b960beeeb9657" title="Tempo di riferimento di inizio della schedulazione.">m_tStart</a>;                       
<a name="l00102"></a><a class="code" href="class_scheduler.html#ad6a88c355f58a1f207cdf3c8590b7012">00102</a>         <span class="keywordtype">int</span>                     <a class="code" href="class_scheduler.html#ad6a88c355f58a1f207cdf3c8590b7012" title="Numero di task creati, utilizzato come ID per i nuovi task creati.">m_iTaskNumber</a>;          
<a name="l00103"></a>00103 
<a name="l00104"></a><a class="code" href="class_scheduler.html#abb366a617ffcd4e007c67212be838e43">00104</a>         <span class="keywordtype">double</span>          <a class="code" href="class_scheduler.html#abb366a617ffcd4e007c67212be838e43" title="Un sistema di task periodici ha la certezza di essere feasible finchè la densità resta minore di uno...">m_dSystemDensity</a>;       
<a name="l00105"></a><a class="code" href="class_scheduler.html#aacbea0df4dc4595cd7d6c657852e2dda">00105</a>         timespec        <a class="code" href="class_scheduler.html#aacbea0df4dc4595cd7d6c657852e2dda" title="Se un determinato task non supera il test entro il tempo massimo prefissato, allora è invalidato...">m_tMaxTestLetnght</a>;      
<a name="l00106"></a><a class="code" href="class_scheduler.html#af306fd3bb8cd7f63ae2660381af19f64">00106</a>         vector&lt;PTask&gt;   <a class="code" href="class_scheduler.html#af306fd3bb8cd7f63ae2660381af19f64" title="Lista dei task attualmente accettati.">m_PTaskList</a>;    
<a name="l00107"></a>00107 
<a name="l00108"></a>00108 <span class="keyword">private</span>:
<a name="l00109"></a><a class="code" href="class_scheduler.html#ab7c58b1dd36a053ae85800030ea1e70d">00109</a>         <span class="keywordtype">bool</span>    <a class="code" href="class_scheduler.html#ab7c58b1dd36a053ae85800030ea1e70d" title="Indica se è necessario generare l&amp;#39;output per kiwi.">m_isKiwiEnabled</a>;                
<a name="l00110"></a><a class="code" href="class_scheduler.html#a6772693322989a84f1d33ac1e4c40b45">00110</a>         <a class="code" href="class_kiwi_logger.html">KiwiLogger</a>* <a class="code" href="class_scheduler.html#a6772693322989a84f1d33ac1e4c40b45" title="Gestore dell&amp;#39;output per kiwi.">m_KiwiLogger</a>;               
<a name="l00111"></a>00111 };
</pre></div></div>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&nbsp;</span>Tutto</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&nbsp;</span>Classi</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&nbsp;</span>File</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&nbsp;</span>Funzioni</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&nbsp;</span>Variabili</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&nbsp;</span>Ridefinizioni di tipo (typedef)</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&nbsp;</span>Definizioni</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Generato il Fri Sep 10 2010 15:26:14 per Schedulatore EDF da&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
</body>
</html>
